Unit 4 Exercise 12
Exercise 12: File Arrival - Multiple Files
Objective
To use File Arrival to detect the arrival of a multiple files and add a container jobs to process each one.
Summary
You are going to create a schedule with three jobs. One job will create the files we are looking for, one will be the File Arrival job to 'look' for the new created files, and the last will be a Container job to process each file found.
Instructions
Create the Sub-Schedule to Process the Files
- In Library > Administration, select on Master Schedule.
- Click the Add button.
- On the Master Schedule Definition screen:
- In the Name field, enter
SS-MultipleFiles
- Add Documentation
- Click Sub Schedule
- Saturday and Sunday are working day
- Do NOT use Master Schedule
- Click Save
- Click Back
Add the Process File Job
- In the Schedule List, search for and select the SS-MultipleFiles sub-schedule.
- Click View
- Click Add Job
- On the Master Job Definition screen:
- In the Name field, enter
Process File
- In the Job Type drop-down, select Windows
- In the Machine Selection drop-down, select SMATraining
- In the User ID drop-down, select SMATRAINING\SMAUSER
- In the Command Line field, enter
"C:\Program Files\OpConxps\MSLSAM\genericp.exe" -t10
- Remember to use properties where acceptable.
- Click Save
- Add Documentation to the Job.
- Give the Job a Frequency of
Mon-Sun-O
. - click Save
- Click Back
Add the Archive File Job
- Click Add Job
- On the Master Job Definition screen:
- In the Name field, enter
Archive File
- In the Job Type dropdown, select Windows.
- In the Machine Selection dropdown, select the SMATraining machine for the Job to run on.
- In the Job Sub-Type section, click the blue Edit button.
- In the Job Sub-Type Details pop-up window:
- Select Command: File Move.
- In the Source field, type
"[[SI.FILENAME]]"
- In the Destination field, type
"C:\Multi-File Arrival\Archive\"
- Click the Save button.
- In the User ID dropdown, select SMATRAINING\SMAUSER
- Click the Save
- Click the Lock button in the upper right-hand corner.
- Add some Documentation to the Job.
- In the Frequency section, move Mon-Sun-O from the Inactive column and to the Active column.
- Click Save
- Click Back
- Make the Archive File job dependent on the Process File job when it completes successfully.
- Click Back
Create the Parent Schedule
- Click the Add button.
- On the Master Schedule Definition screen:
- In the Name field, enter
File Arrival - Multiple Files
- Add Documentation
- Pick your working days
- Configure Auto Build and Auto Delete.
- Click Save
- Click Back
Add the FA MultiFile
- In the Schedule List, search for and select the File Arrival - Multiple Files schedule.
- Click View
- Click Add Job
- On the Master Schedule Definition screen:
- In the Name field, enter
FA MultiFile
- In the Job Type drop-down, select Windows
- In the Machine Selectiondrop-down, select SMATraining
- In the User ID drop-down, select SMATRAINING\SMAUSER
- In the Job Action drop-down, select File Arrival
- In the File Name field, enter
"C:\Multi-File Arrival\MultiFile*.txt"
- In the Start Time drop-down, enter 0 day at
09:00 AM
- In the End Time drop-down, enter 0 day at
06:00 PM
- In the File Size Stable Duration (in secs) drop-down, enter
5
- Add Documentation to the Job.
- Give the Job a Frequency of Mon-Fri-N
- In the Events section, click Add.
- In the Create new Event pop-up window:
- In the Event Trigger drop-down, select the Job Status
- In the Trigger Details drop-down, select Finished OK
- In the Event Template drop-down, select the $JOB:ADD event
- For the Event Parameters, use the following,
- In the Schedule Date field, enter
[[$SCHEDULE DATE]]
- In the Schedule Name field, enter
[[$SCHEDULE NAME]]
, - In the Job Name field, enter
MultiFile Processing Job
- In the Frequency Name field, enter
OnRequest
- In the Job Instance Definition Name field, enter
FILENAME
- In the Job Instance Definition Value field, enter
[[JI.$ARRIVED FILE NAME]]
- Click OK
- Click the Save button
- In the Schedule Date field, enter
- Click Save
- Click Back
Add the Create File Job
- Select Add Job.
- On the Master Job Definition screen:
- In the Name field, enter
Create File
- In the Job Type drop-down, select Windows
- In the Machine Selection drop-down, select SMATraining
- In the Job Action drop-down, select Embedded Script
- In the User ID drop-down, select SMATRAINING\SMAUSER
- In the Script drop-down, select Windows_MultiFile_Arrival
- In the Version drop-down, select LATEST (X)
- In the Runner drop-down, select PowerShell
- Click Save
- Add Documentation to the Job.
- Give the Job a Frequency of Mon-Fri-N
- Select the Frequecny in the Active column, in the Job Build Status drop-down, select On Hold
- Click Save
- click Back
Add the Container Job
- Select Add Job in the side menu.
- On the Job Master Definition screen:
- In the Name textbox, enter
MultiFile Processing Job
. - In the Job Type dropdown list, select Container.
- On the Master SubSchedule dropdown list select SS-MultipleFiles.
- Click the Save button.
- Click the Lock icon in the upper right-hand corner.
- Expand the Documentation box and enter in some documentation.
- Give the Job a Frequency of OnRequest
- In the Create new Event pop-up window:
- In the Event Trigger drop-down, select the Job Status
- In the Trigger Details drop-down, select Finished OK
- In the Event Template drop-down, select the $JOB:RESTART event
- For the Event Parameters, use the following,
- In the Schedule Date field, enter
[[$SCHEDULE DATE]]
- In the Schedule Name field, enter
[[$SCHEDULE NAME]]
, - In the Job Name field, enter
FA MultiFile
- Click the Save button
- In the Schedule Date field, enter
- Click the Save button.
- Click Back.
Build and Verify Results
- Build the File Arrival - Multiple Files for today Released.
- In Processes, notice the FA MultiFile is running (no files arrived yet) and that the MultiFile Processing Job was not built (It will be added by the FA MultiFile).
- Release the Create File Job in the MultipleFiles-Main Schedule. This Job will create the files.
- Notice that as the FA MultiFile finds files, a new Container Job is added for each file. Once it finishes the files will be moved to the Archive folder.
- If you check the Instance Properties of one of the Container Jobs, you will find which file is being processed (from the
[[SI.FILENAME]]
).